Skip to content

[EXPERIMENTAL] rustc_thread_pool: test whether build_scoped waits for thread exit - #166322

Draft
weihanglo wants to merge 2 commits into
rust-lang:mainfrom
weihanglo:windows-gnu-stackoverflow
Draft

weihanglo wants to merge 2 commits into
rust-lang:mainfrom
weihanglo:windows-gnu-stackoverflow

Conversation

@weihanglo

Copy link
Copy Markdown
Member

DO NOT REVIEW THIS.

This is LLM generated code that is seemingly good, though it is not intended for any serious review yet.

See #llm-reviews > LLM for debuggin windows-gnu stack overflow #139070 @ 💬

r? ghost

try-jobs: dist-x86_64-mingw

Records the current behavior: it returns before the threads have exited.
`wait_until_stopped` and the scope's implicit join only wait for the
worker closures to return. The threads may still be exiting, e.g. running
TLS destructors, when `build_scoped` returns. If the process exits then,
they get killed midway, and on windows-gnu rustc sometimes crashes at exit
with a stack overflow.

Join the threads, like `run_in_thread_with_globals` does for the serial
compiler. A worker panic is resumed after all threads are joined.
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 21, 2026
@weihanglo

Copy link
Copy Markdown
Member Author

@bors try

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Nov 21, 2026
[EXPERIMENTAL] rustc_thread_pool: test whether `build_scoped` waits for thread exit

try-jobs: dist-x86_64-mingw
@rust-bors

rust-bors Bot commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 6ebbc66 (6ebbc66bff3bc876e9d5803b8679e85d633cb635)
Base parent: c7d5ba5 (c7d5ba59d8e11ee2e2204b173458eec4cb41c973)

@weihanglo

Copy link
Copy Markdown
Member Author

From my stress testing this does fix the issue. Will create a new issue with some info then

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants